package com.tgu.home_action.service;

import com.tgu.home_action.pojo.Family;
import com.tgu.home_action.pojo.ResponseData;
import com.tgu.home_action.pojo.exception.IMException;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotNull;
import java.io.IOException;

@Validated
public interface FamilyService {
    /**
     * 登录
     *
     * @param code：从微信获取的code
     * @return token, family
     */
    public ResponseData<Family> login(@NotNull(message = "code不能为空") String code);

    /**
     * 更新从微信获取的信息
     *
     * @param familyUser：当前登录的家属用户
     * @return responseData
     */
    ResponseData<Object> updateUserinfo(@NotNull(message = "encryptedData不能为空") String encryptedData, @NotNull(message = "iv不能为空") String iv, Family familyUser);


    /**
     * 完善信息
     */
    ResponseData<Object> bindPhone(@NotNull(message = "phone不能为空") String phone, @NotNull(message = "code不能为空") String code, Family familyUser);

    /**
     * 更新Token
     */
    ResponseData<Object> refreshToken(@NotNull(message = "refreshToken不能为空") String refreshToken);

    /**
     * 获取绑定手机号的验证码
     */
    ResponseData<Object> getBindCode(String phone, Family familyUser);

    /**
     * 获取修改手机号的验证码
     */
    ResponseData<Object> getUpdateCode(String phone, Family familyUser);

    /**
     * 家属上传照片
     */
    ResponseData<String> uploadPhoto(MultipartFile photo, Family familyUser) throws IOException;

    /**
     * 更换头像
     */
    ResponseData<String> updateAvatar(@NotNull(message = "avatarUrl不能为空") String avatarUrl, Family familyUser);

    /**
     * 获取个人信息
     */
    ResponseData<Family> getFamily(Family familyUser);

    /**
     * 获取IM的UserSig
     *
     * @return
     */
    ResponseData<String> getUserSig(Family family) throws IMException;

    /**
     * 修改信息
     */
    ResponseData<Object> updateInfo(Family family, Family familyUser);

    /**
     * 通过ID查询
     */
    ResponseData<Family> getById(Integer id);
}
